/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package All.BO;

import All.DTO.TintucDTO;
import All.Mapper.AccountMapper;
import All.Mapper.TintucMapper;
import java.util.ArrayList;

/**
 *
 * @author NGUYEN DANG
 */
public class TintucBO {
    public TintucBO()
    {}
    public TintucDTO getNewsInformation(String matintuc) throws Exception {
		TintucMapper mapper = null;
                int matin = Integer.parseInt(matintuc);
		try {
			mapper = new TintucMapper();
			return mapper.getNewsInformation(matin);
		}
		catch (Exception e) {
			throw e;
		}
	}
    public ArrayList<TintucDTO> listTintuc() throws Exception {
		TintucMapper mapper = null;
		try {
			mapper = new TintucMapper();
			return mapper.listTintuc();
		}
		catch (Exception e) {
			throw e;
		}
                
    }

    public boolean ADUpdateNews(TintucDTO tintucDTO) throws Exception {
        boolean found = false;
        TintucMapper mapper = null;
        try{
            mapper = new TintucMapper();
            found = mapper.ADUpdateNews(tintucDTO);
        }
        catch(Exception e)
        {
            throw e;
        }
        return found ;
    }

    public boolean InsertNews(TintucDTO tintucDTO) throws Exception {
        boolean found = false;
        TintucMapper mapper = null;
        try{
            mapper = new TintucMapper();
            found = mapper.InsertNews(tintucDTO);
        }
        catch(Exception e)
        {
            throw e;
        }
        return found;
    }

    public boolean ADDeleteNews(String matin) throws Exception 
    {
        boolean found = false;
        TintucMapper mapper = null;
        try{
            mapper = new TintucMapper();
            found = mapper.ADDeleteNews(matin);
        }
        catch(Exception e)
        {
            throw e;
        }
        return found;
    }
}
